import 'dart:async';
import 'dart:io';

import 'package:process_run/shell.dart';

import '../utils/file_util.dart';
import '../val/args_val.dart';
import 'basic_shell.dart';

class ExitCommand extends BasicShell {
  var shell = Shell(runInShell: true);

  ExitCommand(super.args);

  @override
  Future doExecute() async {
    // 定义要进入的目录和要执行的脚本
    String argPath = args[ArgsVal.project];

    String path = Directory.current.path;

    String sourceDir = "$path/sh";
    String destDir = "$argPath/sh";

    await FileUtil.deleteDirectory(sourceDir);
    print("删除目录$sourceDir");
    await FileUtil.deleteDirectory(destDir);
    print("删除目录$destDir");
    exit(0); // 正常退出
  }
}
